package com.zeekr.rocketmq.consumer;

import cn.hutool.core.util.StrUtil;
import org.apache.rocketmq.spring.annotation.ConsumeMode;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;

import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.LocalTime;
import java.time.ZoneId;

/**
 * @author yangyuanping
 */

@Component
public class MqConsumerService {

    @Service
    @RocketMQMessageListener(topic = "demo-topic", consumerGroup = "my-consumer-group")
    public class MyConsumer2 implements RocketMQListener<String> {

        @Override
        public void onMessage(String s) {
            System.out.println("接收到生产者消息: " + LocalTime.now() + "-" + s);
            System.out.println("接收到生产者消息：" + LocalDate.now() + StrUtil.SPACE+ LocalTime.now() + "-" + s);
        }
    }
}
